﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
using SAC.Helper;
using DAL;
using System.Web;

namespace BLL
{
    public class BLLData
    {
        ArrayList list = new ArrayList();
        StringBuilder sb = new StringBuilder();

        DALData da = new DALData();

        //avg+sum 数据集
        public string RetTableByDay(string repName)
        {
            list = da.RetArrsByData(repName);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] ID1 = (string[])list[3];
            string[] ID2 = (string[])list[4];

            if (list.Count > 0)
            {
                for (int i = 0; i < zb.Length; i++)
                {
                    if (zb[i] != null)
                    {
                        sb.Append("<tr>");

                        sb.AppendFormat("<td align='center' id ='" + zb[i] + "'>{0}</td>", zb[i]);

                        if (un[i] != null && un[i] != "")
                            sb.AppendFormat("<td align='center'>{0}</td>", un[i]);
                        else
                            sb.AppendFormat("<td align='center'>{0}</td>", "/");

                        if (lay[i] != null && lay[i] != "")
                            sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);
                        else
                            sb.AppendFormat("<td align='center'>{0}</td>", "/");

                        sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + ID1[i].ToString() + "','1','" + repName + "')\"></td>", "更新数据");

                        sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate2\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + ID2[i].ToString() + "','2','" + repName + "')\"></td>", "更新数据");

                        sb.Append("</tr>");
                    }
                }
            }
            else
            {
                sb.Append("报表内无可维护的记录！");
            }
            return sb.ToString();
        }

        //T_Sheet_SheetPara 行数据
        public DataRow RetDataRowByID(string id)
        {
            return da.RetDataRowByID(id);
        }

        #region 读取数据

        //读取值数据
        public DataTable RetBzValue(string hPoint, string unit, string type, string qsrq, string jsrq)
        {
            return da.RetValueBz(hPoint, unit, type, qsrq, jsrq);
        }

        //读取日数据
        public string RetValue(string hPoint, string unit, string type, string qsrq, string jsrq)
        {
            return da.RetValue(hPoint, unit, type, qsrq, jsrq);
        }

        //读取小数数据
        public ArrayList RetValueHour(string pname, string hPoint, string unit, string type, string qsrq, string jsrq)
        {
            return da.RetValueArrs(hPoint, unit, type, qsrq, jsrq);
        }

        #endregion

        #region 保存数据

        //保存小时数据
        public bool RetIsTrueToSaveHours(string id, string jz, string time, string[] val, string[] bj)
        {
            return da.RetIsTrueToSaveHoursNew(id, jz, time, val, bj);
        }

        //保存值数据
        public bool RetIsTrueToSavaBz(string id, string jz, string time, string tjID, string[] val, string[] bz)
        {
            return da.RetIsTrueToSaveBzNew(id, jz, time, tjID, val, bz);
        }

        //保存日数据
        public bool RetIsTrueToSaveDay(string id, string jz, string time, string zbType, string value)
        {
            return da.RetIsTrueToSaveDayNew(id, jz, time, zbType, value);
        }

        #endregion

        #region  电量数据维护

        //电量指标总体读取
        public string RetArrsDLDescInfo(string dlType, string xlID)
        {
            string[] id = null;
            string[] sbDesc = null;
            string[] sbID = null;
            string[] xlID1 = null;
            string[] lbID = null;

            ArrayList list = new ArrayList();

            list = da.RetArrsDLDescInfo(dlType, xlID);

            if (list != null)
            {
                id = (string[])list[0];
                sbDesc = (string[])list[1];
                sbID = (string[])list[2];
                xlID1 = (string[])list[3];
                lbID = (string[])list[4];

                for (int i = 0; i < id.Length; i++)
                {
                    if (id[i] != null)
                    {
                        sb.Append("<tr>");

                        sb.AppendFormat("<td align='center' id ='1'>{0}</td>", sbDesc[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", xlID1[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", lbID[i]);

                        sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + sbID[i].ToString() + "','" + sbDesc[i].ToString() + "','" + xlID1[i].ToString() + "')\"></td>", "更新数据");

                        sb.Append("</tr>");
                    }
                }
            }
            else
            { sb.Append("线路无可维护记录..."); }

            return sb.ToString();
        }

        //电量数据读取
        public ArrayList RetListDLvalue(string sbID, string qsrq, string jsrq)
        {
            return da.RetListDLvalue(sbID, qsrq, jsrq);
        }

        //电量数据保存
        public bool RetIsTrueByDL(string sbID, string time, string[] val)
        {
            return da.RetIsTruebyDL(sbID, time, val);
        }
        #endregion

        #region 设备换表起码数据表

        //电量数据读取
        public ArrayList RetListDLvalueSB(string sbID, string qsrq, string jsrq)
        {
            return da.RetListDLvalueSB(sbID, qsrq, jsrq);
        }

        //电量数据保存
        public bool RetIsTrueByDLSB(string sbID, string time, string[] val)
        {
            return da.RetIsTruebyDLSB(sbID, time, val);
        }

        //电量指标总体读取
        public string RetArrsDLDescInfoSB(string dlType, string xlID)
        {
            string[] id = null;
            string[] sbDesc = null;
            string[] sbID = null;
            string[] xlID1 = null;
            string[] lbID = null;

            ArrayList list = new ArrayList();

            list = da.RetArrsDLDescInfo(dlType, xlID);

            if (list != null)
            {
                id = (string[])list[0];
                sbDesc = (string[])list[1];
                sbID = (string[])list[2];
                xlID1 = (string[])list[3];
                lbID = (string[])list[4];

                for (int i = 0; i < id.Length; i++)
                {
                    if (id[i] != null)
                    {
                        sb.Append("<tr>");

                        sb.AppendFormat("<td align='center' id ='1'>{0}</td>", sbDesc[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", xlID1[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", lbID[i]);

                        sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + sbID[i].ToString() + "','" + sbDesc[i].ToString() + "','" + xlID1[i].ToString() + "')\"></td>", "更新数据");

                        sb.Append("</tr>");
                    }
                }
            }
            else
            { sb.Append("线路无可维护记录..."); }

            return sb.ToString();
        }

        #endregion

        #region T_sheet_sheetPara 维护

        public string retTableByUnitAndRep(int unit, string repName)
        {
            DataTable dt = da.retTableByUnitAndRep(unit, repName);

            if (dt != null && dt.Rows.Count > 0)
            {
                int j = 0;

                sb.Append("<table width=\"160%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr style=\"width: 98%;\" bgcolor=\"#CFE6FC\">");
                sb.Append("<td style=\"width: 3%;\"> <div align=\"center\"> 编号 </td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">操 作</td>");
                sb.Append("<td style=\"width: 7%;\"><div align=\"center\">参数名</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">小时点</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">日点</td>");
                //sb.Append("<td style=\"width: 5%;\"><div align=\"center\">月点</td>");
                //sb.Append("<td style=\"width: 5%;\"><div align=\"center\">季点</td>");
                //sb.Append("<td style=\"width: 5%;\"><div align=\"center\">年点</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">单位</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">报表名称</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">设计值</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数类型</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">是否显示</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">小数位数</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">显示顺序</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数KEY</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数ID</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">公式</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">公式参数</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">SQL语句</td>");
                //sb.Append("<td style=\"width: 3%;\"><div align=\"center\">最优值</td>");

                sb.Append("</tr>");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    j++;

                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", j.ToString());

                    sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + dt.Rows[i]["ID_KEY"].ToString() + "','bj')\"> <input type=\"button\" id=\"btnUte2\" value=\"{1}\" class=\"nvinput\" onclick=\"deleteRow('" + dt.Rows[i]["ID_KEY"].ToString() + "')\"></td>", "编 辑", "删 除");


                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数名"].ToString());

                    if (dt.Rows[i]["小时点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["小时点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["日点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["日点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["月点"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["月点"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["季点"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["季点"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["年点"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["年点"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["单位"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["单位"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["报表名称"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["报表名称"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["设计值"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["设计值"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");


                    //sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数类型"].ToString());

                    //if (dt.Rows[i]["显示"].ToString() == "1")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "是");
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "否");

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["小数点数"].ToString());

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数顺序"].ToString());

                    //if (dt.Rows[i]["参数KEY"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数KEY"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["参数ID"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数ID"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["公式"] != null && dt.Rows[i]["公式"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btn1\" value=\"{0}\" class=\"nvinput\" onclick=\"window.open('../bgData/SheetGS.aspx?para=gs&id=" + HttpUtility.UrlEncode(dt.Rows[i]["ID_KEY"].ToString()) + "','','height=300,width=300,top=150,left=320,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no')\"></td>", "查 看");
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["公式参数"] != null && dt.Rows[i]["公式参数"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btn1\" value=\"{0}\" class=\"nvinput\" onclick=\"window.open('../bgData/SheetGS.aspx?para=gscs&id=" + dt.Rows[i]["ID_KEY"].ToString() + "','','height=300,width=300,top=150,left=320,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no')\"></td>", "查 看");
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["SQL语句"] != null && dt.Rows[i]["SQL语句"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btn1\" value=\"{0}\" class=\"nvinput\" onclick=\"window.open('../bgData/SheetGS.aspx?para=sql&id=" + dt.Rows[i]["ID_KEY"].ToString() + "','','height=300,width=300,top=150,left=320,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no')\"></td>", "查 看");
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    //if (dt.Rows[i]["最优值"] != null && dt.Rows[i]["最优值"].ToString() != "")
                    //    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["最优值"].ToString());
                    //else
                    //    sb.AppendFormat("<td align='center'>{0}</td>", "/");


                    //sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + dt.Rows[i]["ID_KEY"].ToString() + "','bj')\"> <input type=\"button\" id=\"btnUte2\" value=\"{1}\" class=\"nvinput\" onclick=\"window.open('../bgData/SheetDel.aspx?para=sql&id=" + dt.Rows[i]["ID_KEY"].ToString() + "','','height=1,width=1,top=350,left=350,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no')\"></td>", "编 辑", "删 除");

                    sb.Append("</tr>");
                }

                sb.Append("</table>");


                #region Excel

                j = 0;

                sb.Append("<table width=\"160%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\">");

                sb.Append("<tr style=\"width: 98%;\" bgcolor=\"#CFE6FC\">");
                sb.Append("<td style=\"width: 3%;\"> <div align=\"center\"> 编号 </td>");
                sb.Append("<td style=\"width: 7%;\"><div align=\"center\">参数名</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">小时点</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">日点</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">月点</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">季点</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">年点</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">单位</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">报表名称</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数类型</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">是否显示</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">小数位数</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">显示顺序</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数KEY</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">参数ID</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">公式</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">公式参数</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">SQL语句</td>");
                sb.Append("<td style=\"width: 3%;\"><div align=\"center\">最优值</td>");
                sb.Append("<td style=\"width: 5%;\"><div align=\"center\">操 作</td>");
                sb.Append("</tr>");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    j++;

                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", j.ToString());

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数名"].ToString());

                    if (dt.Rows[i]["小时点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["小时点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["日点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["日点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["月点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["月点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["季点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["季点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["年点"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["年点"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["单位"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["单位"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["报表名称"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["报表名称"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["设计值"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["设计值"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");


                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数类型"].ToString());

                    if (dt.Rows[i]["显示"].ToString() == "1")
                        sb.AppendFormat("<td align='center'>{0}</td>", "是");
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "否");

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["小数点数"].ToString());

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数顺序"].ToString());

                    if (dt.Rows[i]["参数KEY"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数KEY"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["参数ID"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["参数ID"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["公式"] != null && dt.Rows[i]["公式"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["公式"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["公式参数"] != null && dt.Rows[i]["公式参数"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["公式参数"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    if (dt.Rows[i]["SQL语句"] != null && dt.Rows[i]["SQL语句"].ToString() != "")
                        sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["SQL语句"].ToString());
                    else
                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");

                    sb.AppendFormat("<td align='center'>{0}</td>", dt.Rows[i]["最优值"].ToString());

                    sb.AppendFormat("<td align='center'><input type=\"button\" id=\"btnUpdate1\" value=\"{0}\" class=\"nvinput\" onclick=\"openUpdateValue('" + dt.Rows[i]["ID_KEY"].ToString() + "')\"> </td>", "编 辑");

                    //<input type=\"button\" id=\"btnUpdate2\" value=\"{1}\" class=\"nvinput\" onclick=\"openUpdateValue('" + dt.Rows[i]["ID_KEY"].ToString() + "')\">
                    sb.Append("</tr>");
                }

                sb.Append("</table>");

                #endregion
            }
            else
            { sb.Append("数据表中无记录......"); }

            return sb.ToString();
        }

        public DataRow retTableRowById(string id)
        {
            return da.retTableRowByID(id);
        }

        public bool retIsTrueBySQL(string sql)
        {
            return da.retIsTrueBySQL(sql);
        }

        #endregion

        #region 电量测电表数据 维护
        /// <summary>
        /// 电量测电表数据
        /// </summary>
        /// <returns></returns>
        public DataTable RetDLPointTable()
        {
            return da.RetDLPointTable();
        }

        /// <summary>
        /// 执行SQL
        /// </summary>
        /// <param name="sql"></param>
        public bool RunNonQuery(string sql)
        {
            return da.RunNonQuery(sql);
        }

        #endregion

        #region 实时计算测点表维护
        /// <summary>
        /// 实时计算测点表数据
        /// </summary>
        /// <returns></returns>
        public DataTable RetRTPointTable()
        {
            return da.RetRTPointTable();
        }

        /// <summary>
        /// 实时计算测点表数据
        /// </summary>
        /// <returns></returns>
        public DataRow RetRTPointTable(string id)
        {
            return da.RetRTPointTable(id);
        }
        #endregion

        #region 实时统计测点表维护
        /// <summary>
        /// 实时计算测点表数据
        /// </summary>
        /// <returns></returns>
        public DataTable RetRTTJPointTable()
        {
            return da.RetRTTJPointTable();
        }

        /// <summary>
        /// 实时计算测点表数据
        /// </summary>
        /// <returns></returns>
        public DataRow RetRTTJPointTable(string id)
        {
            return da.RetRTTJPointTable(id);
        }
        #endregion

    }
}
